package exercise;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User:22954
 * Date:2024-03-28
 * Time:22:04
 */
@SuppressWarnings("all")
public class Exercise1 {
    public static void main(String[] args) throws IOException {
        String dicPath = "f:/mytmp";
        File file = new File(dicPath);
        file.mkdir();
        String filePath = dicPath + "/helloworld.txt";
        file = new File(filePath);
        if (file.exists()) {
            System.out.println("File already exist!");
        } else {
            file.createNewFile();
            BufferedWriter bw = new BufferedWriter(new FileWriter(file));
            bw.write("Hello World!");
            bw.close();
        }
    }
}
